package com.csdj.t309tgspringboot.service;

import com.csdj.t309tgspringboot.entity.Menu;
import com.csdj.t309tgspringboot.entity.MenuExample;
import com.csdj.t309tgspringboot.mapper.MenuMapper;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class MenuService implements IMenuService{
    @Resource
    private MenuMapper menuMapper;
    private MenuExample menuExample;

    @Override
    public List<Menu> selP(Integer typeId,Integer pid) {
        menuExample = new MenuExample();
        menuExample.createCriteria().andTypeIdEqualTo(typeId).andPidEqualTo(pid);
        List<Menu> selPM = menuMapper.selectByExample(menuExample);
        return selPM;
    }

    @Override
    public List<Menu> selSon(Integer pid) {
        menuExample = new MenuExample();
        menuExample.createCriteria().andPidEqualTo(pid);
        List<Menu> selSonM = menuMapper.selectByExample(menuExample);
        return selSonM;
    }
}
